//
//  YCMineHeadrView.m
//  YCVillageDoctor
//
//  Created by zhangxiaoliang on 2017/6/7.
//  Copyright © 2017年 zhangxiaoliang. All rights reserved.
//

#import "YCMineHeadrView.h"
#import "UIImageView+WebCache.h"
#import "YCExpertInfoModel.h"
#import "MenberModel.h"

@interface  YCMineHeadrView()
@property(nonatomic,strong)UIImageView *imageIcon;

@property(nonatomic,strong)UILabel *labelName;

@property(nonatomic,strong)UILabel *labelJob;

@property(nonatomic,strong)UILabel *labelPhone;

@property(nonatomic,weak)UILabel *orderTimeTag;

@property(nonatomic,weak)UILabel *startTimeLabel;

@property(nonatomic,weak)UILabel *endTimeLabel;

@property(nonatomic,strong)UIImageView *imageArrow;
@end
@implementation YCMineHeadrView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self stupUI];
    }
    return self;
}

- (void)stupUI
{
    UIImageView *imageBg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"矩形-4"]];
    [self addSubview:imageBg];
    
    UIImageView *imageIcon = [[UIImageView alloc]init];
    imageIcon.image = [UIImage imageNamed:@"矢量智能对象"];
    self.imageIcon = imageIcon;
    imageIcon.layer.cornerRadius = 30;
    imageIcon.layer.masksToBounds = YES;
    [self addSubview:imageIcon];
    
    
    UILabel *labelName = [[UILabel alloc]init];
    labelName.text = @"姓名";
    labelName.font = [UIFont boldSystemFontOfSize:19];
    labelName.textColor = [UIColor whiteColor];
    self.labelName = labelName;

    [self addSubview:labelName];
    
    UILabel *labelJob = [[UILabel alloc]init];
//    labelJob.text = @"职业";
    self.labelJob = labelJob;
    labelJob.textColor = [UIColor whiteColor];
    [self addSubview:labelJob];
    
    
    UILabel *labelPhone = [[UILabel alloc]init];
    labelPhone.textColor = [UIColor whiteColor];
    labelPhone.text = @"手机号码:";
    self.labelPhone = labelPhone;
    [self addSubview:labelPhone];
     
    UIImageView *imageArrow = [[UIImageView alloc]init];
    imageArrow.image = [UIImage imageNamed:@"圆角矩形-1-拷贝-3"];
    imageArrow.contentMode = UIViewContentModeCenter;
    self.imageArrow = imageArrow;
    [self addSubview:imageArrow];
    //布局
    __weak __typeof(&*self)mySelf = self;
    
    [imageBg mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(mySelf.mas_top).mas_offset(0);
        make.left.mas_equalTo(mySelf.mas_left).mas_offset(0);
        make.width.mas_equalTo(mySelf.mas_width);
        make.height.mas_equalTo(mySelf.mas_height);
    }];

    
    
    [imageIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(mySelf.mas_top).mas_offset(30);
        make.left.mas_equalTo(mySelf.mas_left).mas_offset(30);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(60);
    }];
    
    
    [labelName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(imageIcon.mas_top).mas_offset(5);
        make.left.mas_equalTo(imageIcon.mas_right).mas_offset(20);
        make.height.mas_equalTo(25);
    }];
    [labelJob mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.mas_equalTo(labelName.mas_bottom).mas_offset(0);
        make.left.mas_equalTo(labelName.mas_right).mas_offset(20);
        make.height.mas_equalTo(25);
    }];
    
    [labelPhone mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(labelName.mas_bottom).mas_offset(5);
        make.left.mas_equalTo(imageIcon.mas_right).mas_offset(20);
        make.height.mas_equalTo(25);
    }];
    
    [imageArrow mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(self.mas_right).mas_offset(-5);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(25);
    }];
    
}

- (void)setModel:(MenberModel *)model
{
    _model = model;
    [_imageIcon sd_setImageWithURL:[NSURL URLWithString:model.memberPic] placeholderImage:[UIImage imageNamed:@"矢量智能对象"]];
    _labelName.text = model.memberName;
//    _labelJob.text = model.;
    _labelPhone.text = model.memberMobile;
}


@end
